#include <cstring>
#include <iostream>
#include <algorithm>


class BigNum {
private:
  std::string num;

public:
  BigNum();
  BigNum(std::string number);
  void setNum(std::string number);
  BigNum operator+ (const BigNum& rhs) const;
  BigNum operator- (const BigNum& rhs) const;
  void print(const char c) const;
};

BigNum::BigNum() {}

BigNum::BigNum(std::string number) {
  num = number;
  std::reverse(num.begin(), num.end());
}

void BigNum::setNum(std::string number) {
  num = number;
  std::reverse(num.begin(), num.end());
}

BigNum BigNum::operator+(const BigNum &rhs) const {
  BigNum res;
  res.num.resize(std::max(rhs.num.length(), num.length()) + 1);
  for (int i = 0; i < res.num.length() - 1; ++i) {
    res.num[i] = (i < num.length() ? num[i] - '0' : 0) 
               + (i < rhs.num.length() ? rhs.num[i] - '0' : 0);
    if (res.num[i] >= 10) {
      res.num[i] -= 10;
      ++res.num[i + 1];
    }

    res.num[i] += '0';
  }

  if (res.num.back() == '0') {
    res.num.pop_back();
  }

  return res;
}

BigNum BigNum::operator-(const BigNum &rhs) const {
  BigNum res;
  res.num.resize(num.length());
  for (int i = 0; i < res.num.length(); ++i) {
    res.num[i] = (i < num.length() ? num[i] - '0' : 0) 
               - (i < rhs.num.length() ? rhs.num[i] - '0' : 0);
    if (res.num[i] < 0) {
      res.num[i] += 10;
      --res.num[i + 1];
    }

    res.num[i] += '0';
  }

  while (res.num.length() > 1 && res.num.back() == '0') {
    res.num.pop_back();
  }

  return res;
}

void BigNum::print(const char c = '\n') const {
  for (int i = num.length() - 1; ~i; --i) {
    std::cout << num[i];
  }

  std::cout << c;
}

int main() {
  BigNum A, B;
  std::string a, b;
  std::cin >> a >> b;
  A.setNum(a), B.setNum(b);
  int type;
  std::cin >> type;
  if (type == 1) {
    BigNum C = A + B;
    C.print();
  } else {
    BigNum C = A - B;
    C.print();
  }

  return 0;
}